<?php

// 9/5/2009: immanuel19 rewrite this class

class imagegallery_gallery {
	function form($object) {
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();
		
		$form = new form();
		if (!isset($object->id)) {
			$object->name = '';
			$object->description = '';
			$object->box_size = 150;
			$object->perpage = 7; // row per page
			$object->perrow = 3; // image per row
			$object->gallery_collection=0;
		} else {
			$form->meta('id',$object->id);
		}
		//depricated for form controls
		
		$form->register('name','Name',new textcontrol($object->name));
		$form->register('description','Description',new htmleditorcontrol($object->description));
		$form->register('box_size','Thumbnail Size (pixels)',new textcontrol($object->box_size));
		$form->register('perrow','Images per Row',new textcontrol($object->perrow));
		$form->register('perpage','Rows per page',new textcontrol($object->perpage));
		$form->register('gallery_collection',"Image Collection",new file_collection_control($object->gallery_collection));
		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
		return $form;
	}
	
	function update($values,$object) {
		$object->name = $values['name'];
		$object->description = $values['description'];
		$object->box_size = $values['box_size'];
		$object->gallery_collection = intval($values['gallery_collection']);
		$object->perpage = $values['perpage'];
		$object->perrow = $values['perrow'];
		return $object;
	}
}

?>